<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>审核</title>
    <script src="../layui/layui.js"></script>
    <link rel="stylesheet" href="../layui/css/layui.css">
    <script src="../src/static/jquery.js"></script>
    <link rel="stylesheet" href="audit.css">
</head>
<body>
<div class="tupian">
    <img src="../src/images/logo_yellow.png" style="text-align: center"/>
</div>
<div class="nav_top">
    <div class="layui-container">
        <div class="layui-row">
            <div class="nav_zt">公司名称：<label id="name1" class="nav_ztt"></label></div>
            <div class="nav_zt">手机号码：<label id="name2" class="nav_ztt"></label></div>
            <div class="nav_zt">存放地址：<label id="name3" class="nav_ztt"></label></div>
        </div>
        <div class="layui-row layui-col-space20">
            <div class="layui-col-md2">
                <div class="nav_zp">法人持身份证拍照：</div>
            </div>
            <div class="layui-col-md2" id="click1">
                <div class="nav_kk" id="photo1"></div>
            </div>
        </div>
        <div class="layui-row layui-col-space20">
            <div class="layui-col-md2">
                <div class="nav_zp">营业执照：</div>
            </div>
            <div class="layui-col-md2" id="click7">
                <div class="nav_kk" id="photo7"></div>
            </div>
        </div>
        <div class="layui-row layui-col-space20">
            <div class="layui-col-md2">
                <div class="nav_zp">公司外景：</div>
            </div>
            <div class="layui-col-md2" id="click2">
                <div class="nav_kk" id="photo2"></div>
            </div>

        </div>
        <div class="layui-row layui-col-space20">
            <div class="layui-col-md2">
                <div class="nav_zp">公司内景：</div>
            </div>
            <div class="layui-col-md3" id="click3">
                <div class="nav_kk" id="photo3"></div>
            </div>
            <div class="layui-col-md2" id="click4">
                <div class="nav_kk" id="photo4"></div>
            </div>
        </div>
        <div class="layui-row layui-col-space20">

            <div class="layui-col-md2">

            </div>
            <div class="layui-col-md3" id="click5">
                <div class="nav_kk" id="photo5"></div>
            </div>
            <div class="layui-col-md2" id="click6">
                <div class="nav_kk" id="photo6"></div>
            </div>
        </div>
        <div class="layui-row layui-col-space20">
            <div class="layui-col-md1">
                <div class="nav_zp">状态：</div>
            </div>
            <div class="layui-col-md3">
                <label id="zt" class="nav_ztt"></label>
            </div>

        </div>
        <div class="layui-row layui-col-space20" id="yx" style="display: none">
            <div class="layui-col-md1">
                <div class="nav_zp">原因：</div>
            </div>
            <div class="layui-col-md3">
                <div>
                    <label class="nav_ztt" id="xn"></label>
                </div>
            </div>


        </div>

        <div class="layui-row bttn" id="td">
            <div class="layui-col-md2 layui-col-md-offset3">
                <div class="layui-btn layui-btn-normal" id="tongguo">申请通过</div>
            </div>
            <div class="layui-col-md2">
                <div class="layui-btn layui-btn-danger" id="bohui">申请驳回</div>
            </div>
        </div>
    </div>
</div>
<div class="nav_but">
    <div class="yanse">版权所有 Copyright2017 All Rights Reserved</div>
    <div class="yanse">上海定希自有设备租赁有限公司 <a href="http://www.miitbeian.gov.cn">沪ICP备17052837号-1</a></div>
</div>
<script>
    // 正则表达式获取设备编号
    function getQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return decodeURI(r[2]);
        return null;
    }

    var param = getQueryString('_ijt');
    //            alert(param);
    $.ajax({
        url: '/api/getCompanyById',
        data: {id: param},
        type: 'get',
        datatype: 'json',
        success: function (data) {
            var data = eval("(" + data + ")")
            $('#name1').html(data.data.companyName);
            $('#name2').html(data.data.phone);
            $('#name3').html(data.data.depositAddress);
            if (data.data.status == 0) {
                $('#zt').html("申请中");
            } else if (data.data.status == 1) {
                $('#zt').html("申请已通过");
            } else if (data.data.status == 2) {
                $('#zt').html("申请未通过");
            }
            if (data.data.status == 1 || data.data.status == 2) {
                $("#td").css({
                    "display": "none"
                })
            }
            if (data.data.status == 2) {
                $("#yx").show();
                var str = "";
                var arr = data.data.reason;

                var result = arr.split(",");
                for (var i = 0; i < result.length; i++) {
                    if (result[i] == 1) {
                        $('#xn').append("公司外景不清晰" + "<br>");
                    } else if (result[i] == 2) {
                        $('#xn').append("公司内景照不清晰" + "<br>");
                    } else if (result[i] == 3) {
                        $('#xn').append("法人身份证与营业执照不一致" + "<br>");
                    } else if (result[i] == 4) {
                        $('#xn').append("公司名称与营业执照不一致");
                    }
                }
//                alert(str);
//                $('#xn').html(str);
            }

            $('#photo1').css({
                'background-image': 'url("' + data.data.taxPic + '")',
                'background-position': 'center',
                'background-repeat': 'no-repeat',
                'background-size': 'cover'
            });
            $('#photo7').css({
                'background-image': 'url("' + data.data.businessPic + '")',
                'background-position': 'center',
                'background-repeat': 'no-repeat',
                'background-size': 'cover'
            });
            $('#photo2').css({
                'background-image': 'url("' + data.data.gatePic1 + '")',
                'background-position': 'center',
                'background-repeat': 'no-repeat',
                'background-size': 'cover'
            });
            $('#photo3').css({
                'background-image': 'url("' + data.data.gatePic2 + '")',
                'background-position': 'center',
                'background-repeat': 'no-repeat',
                'background-size': 'cover'
            });
            $('#photo4').css({
                'background-image': 'url("' + data.data.gatePic3 + '")',
                'background-position': 'center',
                'background-repeat': 'no-repeat',
                'background-size': 'cover'
            });
            $('#photo5').css({
                'background-image': 'url("' + data.data.gatePic4 + '")',
                'background-position': 'center',
                'background-repeat': 'no-repeat',
                'background-size': 'cover'
            });
            $('#photo6').css({
                'background-image': 'url("' + data.data.gatePic5 + '")',
                'background-position': 'center',
                'background-repeat': 'no-repeat',
                'background-size': 'cover'
            });
            $(document).ready(function () {
                $('#click1').click(function () {
                    window.open(data.data.taxPic);
                });
                $('#click7').click(function () {
                    window.open(data.data.businessPic);
                });
                $('#click2').click(function () {
                    window.open(data.data.gatePic1);
                });
                $('#click3').click(function () {
                    window.open(data.data.gatePic2);
                });
                $('#click4').click(function () {
                    window.open(data.data.gatePic3);
                });
                $('#click5').click(function () {
                    window.open(data.data.gatePic4);
                });
                $('#click6').click(function () {
                    window.open(data.data.gatePic5);
                });
            });

        }
    });
    $(document).ready(function () {
        $('#tongguo').click(function () {
//            alert(param+','+1);
            $.ajax({
                url: '/api/updateCompany',
                data: {id: param, status: 1},
                type: 'get',
                datatype: 'json',
                success: function (data) {
                    window.location.href = '/putIn/examine.html'
                },
                error: function (error) {
                    //请求失败  获取的报错信息
                    console.log(error);
                }
            })
        });
        $('#bohui').click(function () {
            layui.use('layer', function () {
                var layer = layui.layer;
                layer.open({
                    type: 2,
                    area: ['400px', '400px'],
                    content: "/putIn/reject.html?_ijt=" + param
                });
            });
        });
    });
</script>
</body>
</html>